/*    */ package com.newcrm.webapi.sub;
/*    */ 
/*    */ import com.newcrm.bean.CompanyInfo;
/*    */ import com.newcrm.bean.CustomerInfo;
/*    */ import com.newcrm.bean.User;
/*    */ import com.newcrm.db.CustomerFieldManager;
/*    */ import com.newcrm.db.CustomerManager;
/*    */ import com.newcrm.exception.DBException;
/*    */ import com.newcrm.exception.NotFoundException;
/*    */ import com.newcrm.util.Util;
/*    */ import com.newcrm.webapi.AbstractAction;
/*    */ import com.newcrm.webapi.AbstractHttpServlet;
/*    */ import java.io.IOException;
/*    */ import java.util.List;
/*    */ import javax.servlet.RequestDispatcher;
/*    */ import javax.servlet.ServletException;
/*    */ import javax.servlet.http.HttpServletRequest;
/*    */ import javax.servlet.http.HttpServletResponse;
/*    */ import org.apache.log4j.Logger;
/*    */ 
/*    */ public class ShowUpdatePeople extends AbstractAction
/*    */ {
/* 32 */   private static Logger logger = Logger.getLogger(ShowUpdatePeople.class
/* 33 */     .getName());
/*    */ 
/* 35 */   private int id = 0;
/*    */ 
/*    */   public ShowUpdatePeople(AbstractHttpServlet servlet) {
/* 38 */     super(servlet);
/*    */   }
/*    */ 
/*    */   public ShowUpdatePeople(AbstractHttpServlet servlet, String id) {
/* 42 */     super(servlet);
/* 43 */     this.id = Util.str2Int(id);
/*    */   }
/*    */ 
/*    */   public void parse(HttpServletRequest request, HttpServletResponse response)
/*    */     throws IOException, ServletException, NotFoundException
/*    */   {
/* 49 */     CustomerManager manager = new CustomerManager();
/*    */     try {
/* 51 */       CustomerInfo customerInfo = manager.getCustomerInfo(this.id, false, 
/* 52 */         true);
/* 53 */       if (customerInfo == null) {
/* 54 */         throw new NotFoundException();
/*    */       }
/* 56 */       if (1 != customerInfo.type)
/*    */       {
/* 58 */         throw new NotFoundException();
/*    */       }
/* 60 */       User user = super.getLoginUser(request);
/*    */ 
/* 62 */       String ip = Util.getClientIpAddr(request);
/* 63 */       logger.warn("ip:" + ip + " / 用户Id：" + user.userId + " /  用户名：" + 
/* 64 */         user.name + ", 浏览了公司：id:  " + customerInfo.id + " / 名称：" + 
/* 65 */         customerInfo.name);
/*    */ 
/* 69 */       if (!customerInfo.hasModifyRight(user, 
/* 69 */         super.getCompany(user.companyId).users)) {
/* 70 */         request.getRequestDispatcher("/nopermission.jsp").forward(
/* 71 */           request, response);
/* 72 */         return;
/*    */       }
/*    */ 
/* 75 */       CustomerFieldManager fieldManager = new CustomerFieldManager();
/* 76 */       List fields = fieldManager.list(
/* 77 */         user.companyId, 2);
/* 78 */       request.setAttribute("fields", fields);
/* 79 */       request.setAttribute("customerInfo", customerInfo);
/* 80 */       request.getRequestDispatcher("/people_modify.jsp").forward(request, 
/* 81 */         response);
/*    */     } catch (DBException e) {
/* 83 */       logger.warn("get people detail failed", e);
/*    */     }
/*    */   }
/*    */ }

/* Location:           C:\E\referenceProject\CRM参考\qikebao\WEB-INF\lib\qikebao.jar
 * Qualified Name:     com.newcrm.webapi.sub.ShowUpdatePeople
 * JD-Core Version:    0.6.1
 */